<?php
session_start();
include('config.php');
//include('header.php');
require_once('classes/class.jira.php');
include("classes/connect.php");
require_once ('reports/calendar/src/Google_Client.php');
require_once ('reports/calendar/src/contrib/Google_CalendarService.php');
ini_set('display_errors', 'Off');

	/*$query="SELECT a.id, a.modifiedDate, b.modifiedDate, b.id, b.mainId
			FROM trn_emaildetails a
			INNER JOIN trn_activity b ON a.id = b.mainID
			WHERE a.modifiedDate =  ''
			ORDER BY b.id DESC
			LIMIT 1";*/

$username = $_SESSION["Juname"];
$pass = $_SESSION["Jpass"];

function getName($username,$pass,$host,$name){
        $config->username= $username;
        $config->password= $pass;
        $config->port= "";
        $config->host= $host;

        $queryIssue = new Jira($config);
        $array=$queryIssue->getUser($name);
        $response = json_decode($array->responseBody);
        return $response;
        }
        
//$query="SELECT id, jiraTaskID from trn_emaildetails WHERE modifiedDate=''";
//	$query="SELECT MIN(date(FROM_UNIXTIME(a.dateReceived))) as minDate, MAX(date(FROM_UNIXTIME(a.modifiedDate))) AS maxDate from trn_emaildetails a INNER JOIN sys_jobposts b ON b.code=a.post   WHERE a.currentStatus='OpenCV' AND a.deleted='0'  ORDER BY a.dateReceived DESC";
	
        
       $query="SELECT  *, year(FROM_UNIXTIME(modifiedDate)) as ye from trn_activity";
	$rshistory =mysql_query($query);
	$i=1;
	while($rowhistory = mysql_fetch_array($rshistory)){		
		
		
		print_r($i.'  '.$rowhistory['id'].'  _-----------------  '.$rowhistory['ye']. '<br>');
		
		$i=$i+1;
		
		
	}
	
     /*   $query="DELETE FROM trn_activity WHERE mainId='1'";
        mysql_query($update);*/
        

	
	
?>